package com.qingke.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.qingke.mapper.ClassStatusMapper;
import com.qingke.mapper.ClassTypeMapper;
import com.qingke.mapper.ClassesMapper;
import com.qingke.pojo.ClassStatus;
import com.qingke.pojo.ClassType;
import com.qingke.pojo.Classes;
import com.qingke.service.ClassService;
@Service("classService")
public class ClassServiceImpl implements ClassService {
	@Resource
	private ClassesMapper clDao;
	@Resource
	private ClassStatusMapper clsDao;
	@Resource
	private ClassTypeMapper cltDao;

	public int saveClass(Classes record) {
		return clDao.insertSelective(record);
	}

	public int softDeleteClass(int id) {
		return clDao.softDelete(id);
	}

	public Classes getClassById(int id) {
		return clDao.selectByPrimaryKey(id);
	}

	public Classes getClassByClassName(String name) {
		return clDao.selectByClassName(name);
	}

	public List<Classes> listClass() {
		return clDao.listClass();
	}

	public int updateClass(Classes record) {
		return clDao.updateByPrimaryKeySelective(record);
	}

	public int saveClassStatus(ClassStatus record) {
		return clsDao.insertSelective(record);
	}

	public ClassStatus getClassStatusById(int id) {
		return clsDao.selectByPrimaryKey(id);
	}

	public ClassStatus getClassStatusByName(String name) {
		return clsDao.selectByName(name);
	}

	public int updateClassStatus(ClassStatus record) {
		return clsDao.updateByPrimaryKeySelective(record);
	}

	public int saveClassType(ClassType record) {
		return cltDao.insertSelective(record);
	}

	public ClassType getClassTypeById(int id) {
		return cltDao.selectByPrimaryKey(id);
	}

	public ClassType getClassTypeByName(String name) {
		return cltDao.selectByName(name);
	}

	public int updateClassType(ClassType record) {
		return cltDao.updateByPrimaryKeySelective(record);
	}

}
